
/*package com.cskaoyan.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

*//**
 * 创建日期: 2022/05/06 09:15
 *
 * @author JinLu Zhou
 *//*
@RestController
@RequestMapping("admin/storage")
public class StorageController {

}*/

package com.cskaoyan.controller;


import com.cskaoyan.bean.StorageInfo.StorageVo;
import com.cskaoyan.bean.param.BaseParam;
import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.MarketStorage;
import com.cskaoyan.service.StorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("admin/storage")
public class StorageController {
    @Autowired
    StorageService storageService;
    @GetMapping(value = "list")
    public BaseRespVo getList( BaseParam param) {
        StorageVo storageVo = storageService.query(param);
        if(storageVo==null){return null;}
        return  BaseRespVo.ok(storageVo);
    }

    @PostMapping(value = "create")
    public BaseRespVo getCreate(MultipartFile file) throws IOException {
        MarketStorage reMarketStorage = storageService.Create(file);
        return  BaseRespVo.ok(reMarketStorage);
    }
    @PostMapping(value = "delete")
    public BaseRespVo getDelete(@RequestBody MarketStorage file) throws IOException {
      storageService.delete(file);
        return  BaseRespVo.ok(null);
    }
    @PostMapping(value = "update")
    public BaseRespVo getUpdate(@RequestBody MarketStorage file) throws IOException {
        storageService.update(file);
        return  BaseRespVo.ok(null);
    }
}

